<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript"
			src="<s:url value="/js/jquery-1.3.2.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.bgiframe.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.ajaxQueue.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/thickbox-compressed.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<script type='text/javascript' src="<s:url value="/js/tableSel2.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/thickbox.css"/>" />
		<script type="text/javascript">
	function doSubmit() {
		// here is validate form .
		$('#listForm').submit();
	};
    $().ready( function ()
		 {
	       $("#teachername").autocomplete("<s:url value="/data/Teacher/autoCompleteAjax.action"/>", {
              width: 260,
              minChars:1, //几个字
              selectFirst: false,
              max:  20,
           	  formatItem: function(row, i, max) {
           	      //alert(row);
           	      var d=eval("("+row+")");
           	      //alert(d);
			      return  d.name;
	         },
		     formatMatch: function(row, i, max) {
		        var d=eval("("+row+")");
 			    return d.name;
		     },
		     formatResult: function(row) {
		        // alert(row);
		         var d=eval("("+row+")");
			     return d.name;
     	      }
           }
           );
           	$("#teachername").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#teacherid").val(d.id);
           });
         });
</script>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<s:form action="ClassArrange/teacherCalendar" name="listForm"
						id="listForm" namespace="/academic">
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="searchbg">
							<tr>
								<td>
									Year:
									<s:select id="year" list="{2008,2009,2010,2011}" name="year">
									</s:select>
									Week:
									<s:select id="week"
										list="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52}"
										name="week">
									</s:select>
									Teacher:
									<s:textfield id="teachername" name="teachername" />
									<s:hidden id="teacherid" name="teacherid" />
									<img src="<s:url value="/img/right/btns.gif"/>" border="0"
										onclick="javascript:doSubmit();" align="absmiddle" />
									<br>
								</td>
							</tr>
						</table>
						<table>
							<tr>
								<td>
									<table width="100%" border="0" cellpadding="0" cellspacing="1"
										class="box2 activeTable">
										<tr height="28px">
											<th class="tablecolour1" width="80">
												&nbsp;
												<br>
											</th>
											<s:iterator value="normalDays" status="st1">
												<th class="tablecolour1" width="100">
													<s:set name="bday" />
													<s:date name="bday" format="E" />
													<br />
													<s:date name="bday" format="yyyy-MM-dd" />
												</th>
											</s:iterator>
										</tr>
										<s:iterator value="normalTimeline" status="st2">
											<tr>
												<td class="tablecolour1">
													<s:set name="btime" value="normalTimeline.get(#st2.index)" />
													<s:property value="normalTimeline.get(#st2.index)" />
												</td>
												<s:iterator value="normalDays" status="st3">
													<s:set name="bday" />
													<td class="tablecolour2" align="center" width="100">
														<s:property
															value="getClassEntityInfo(#bday,#btime,teacherid)" />
														&nbsp;
													</td>
												</s:iterator>
											</tr>
										</s:iterator>
									</table>
								</td>
								<td>
									<table width="100%" border="0" cellpadding="0" cellspacing="1"
										class="box2 activeTable">
										<tr height="28px">
											<th class="tablecolour1" width="80">
												&nbsp;
												<br>
											</th>
											<s:iterator value="weekendDays" status="st1">
												<th class="tablecolour1" width="100">
													<s:set name="bday" />
													<s:date name="bday" format="E" />
													<br />
													<s:date name="bday" format="yyyy-MM-dd" />
												</th>
											</s:iterator>
										</tr>
										<s:iterator value="weekendTimeline" status="st2">
											<tr>
												<td class="tablecolour1">
													<s:set name="btime" value="weekendTimeline.get(#st2.index)" />
													<s:property value="weekendTimeline.get(#st2.index)" />
												</td>
												<s:iterator value="weekendDays" status="st3">
													<s:set name="bday" />
													<td class="tablecolour2" align="center" width="100">
														<s:property
															value="getClassEntityInfo(#bday,#btime,teacherid)" />
														&nbsp;
													</td>
												</s:iterator>
											</tr>
										</s:iterator>
									</table>
								</td>
							</tr>
						</table>

					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
	</body>
</html>
